import request from '@/utils/service'

import type { IDepartmentPageQueryDto, IRolePageQueryDto } from '@/api/types'

enum API {
  DEPARTMENTS_URL = '/system/department/pageQuery',
  ROLES_URL = '/system/role/pageQuery',
  MENUINFO_URL = '/system/menu/pageQuery'
}

// export const getEntireUser = (
//   data: IUserPageQueryDto = { limit: 10, page: 1 }
// ) => {
//   const url = API.USER_PAGE_URL
//   return request.post({ url, data })
// }

/**
 * 获取所有部门信息分页数据
 * @param dto 部门分页查询参数
 * @returns
 */
export const getEntireDepartment = (
  data: IDepartmentPageQueryDto = { limit: 10, page: 1 }
) => {
  const url = API.DEPARTMENTS_URL
  return request.post({ url, data })
}

/**
 * 获取所有角色信息分页数据
 * @param dto 角色分页查询参数
 * @returns
 */
export const getEntireRole = (
  data: IRolePageQueryDto = { limit: 10, page: 1 }
) => {
  const url = API.ROLES_URL
  return request.post({ url, data })
}

export const getEntireMenu = (data: {} = { limit: 10, page: 1 }) => {
  const url = API.MENUINFO_URL
  return request.post({ url, data })
}
